--- description: Comparing WebGL with Scattergl() to SVG with Scatter() in Python with Plotly. has_thumbnail: False language: python layout: base name: Comparing WebGL vs SVG page_type: example_index permalink: python/compare-webgl-svg/ thumbnail: /images/static-image title: Comparing WebGL vs SVG | plotly v4upgrade: True --- {% raw %}
Now in Ploty you can implement WebGL with Scattergl() in place of Scatter()
for increased speed, improved interactivity, and the ability to plot even more data!
import plotly.graph_objects as go
import numpy as np
np.random.seed(1)
N = 75000
fig = go.Figure()
fig.add_trace(
go.Scattergl(
x = np.random.randn(N),
y = np.random.randn(N),
mode = 'markers',
marker = dict(
line = dict(
width = 1,
color = 'DarkSlateGrey')
)
)
)
fig.update_layout(title_text = 'WebGL')
fig.show()
import plotly.graph_objects as go
import numpy as np
N = 75000
fig = go.Figure()
fig.add_trace(
go.Scatter(
x = np.random.randn(N),
y = np.random.randn(N),
mode = 'markers',
marker = dict(
line = dict(
width = 1,
color = 'DarkSlateGrey')
)
)
)
fig.update_layout(title_text = 'SVG')
fig.show()
For more information see
Scattergl() : https://plot.ly/python/reference/#scattergl
Scatter() : https://plot.ly/python/reference/#scatter